Carbon


GetGray

Header: Palettes.h Carbon status: Supported

Determines the best intermediate color between two colors on a given graphics device.

Boolean GetGray (
    GDHandle device, 
    const RGBColor *backGround, 
    RGBColor *foreGround
);
Parameter descriptions
device

A handle to the graphics device for which an intermediate color or gray is needed.

backGround

The RGBColor structure for one of the two colors for which you want an intermediate color.

foreGround

On input, the RGBColor structure for the other of the two colors; upon completion, the best intermediate color between these two.

function result

If no gray is available (or if no distinguishable third color is available), the foreGround parameter is unchanged, and the function returns FALSE. If at least one gray or intermediate color is available, it is returned in the foreGround parameter, and the function returns TRUE.

DISCUSSION

The GetGray function determines the midpoint values for the red, green, and blue values of the two colors you specify in the backGround and foreGround parameters.

You can also use GetGray to return the best gray. For example, when dimming an object, supply black and white as the two colors, and GetGray returns the best available gray that lies between them.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)